<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE data_user SET nama_user=%s, email=%s, nama_site=%s, bio_site=%s WHERE id=%s",
                       GetSQLValueString($_POST['nama_user'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['nama_site'], "text"),
                       GetSQLValueString($_POST['bio_site'], "text"),
                       GetSQLValueString($_POST['id'], "int"));

  mysql_select_db($database_konek, $konek);
  $Result1 = mysql_query($updateSQL, $konek) or die(mysql_error());

}

?>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td valign="top" nowrap="nowrap"><strong>Nama user : </strong></td>
      <td><input type="text" name="nama_user" value="<?php echo htmlentities($row_admin['nama_user'], ENT_COMPAT, 'utf-8'); ?>" size="32" class="form-control" /></td>
    </tr>
    <tr valign="baseline">
      <td valign="top" nowrap="nowrap"><strong>Email :</strong></td>
      <td><input type="text" name="email" value="<?php echo htmlentities($row_admin['email'], ENT_COMPAT, 'utf-8'); ?>" size="32" class="form-control" /></td>
    </tr>
    <tr valign="baseline">
      <td valign="top" nowrap="nowrap"><strong>Nama site :</strong></td>
      <td><input type="text" name="nama_site" value="<?php echo htmlentities($row_admin['nama_site'], ENT_COMPAT, 'utf-8'); ?>" size="32" class="form-control" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" valign="top"><strong>Bio site :</strong></td>
      <td><textarea name="bio_site" cols="50" rows="5" class="form-control" ><?php echo htmlentities($row_admin['bio_site'], ENT_COMPAT, 'utf-8'); ?></textarea></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Save" id="status-update-btn" class="btn btn-primary pull-right" />
        <a href="home.php?page=ubahpass">change password</a></td>
    </tr>
  </table>
  <input type="hidden" name="id" value="<?php echo $row_admin['id']; ?>" />
  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="id" value="<?php echo $row_admin['id']; ?>" />
</form>